package com.example.template.config;/*
package com.example.demo.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

import javax.sql.DataSource;

*/
/**
 * @author BuerYouth
 *//*

@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
    
    @Autowired
    private DataSource dataSource;
    
    @Override
    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
        // TODO Auto-generated method stub
        BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
        // 从内存进行安全验证
        // auth.inMemoryAuthentication().passwordEncoder(encoder).withUser("buer").password("123456").roles("root");
        // 从JDBC进行安全验证
        String userSql = "select username,password from users where useremail = ?";
        String authoritySql = "";
        auth.jdbcAuthentication().passwordEncoder(encoder).dataSource(dataSource).usersByUsernameQuery(userSql)
                .authoritiesByUsernameQuery(authoritySql);
    }
}
*/
